<?php

namespace common\models;

use Yii;

/**
 * This is the model class for table "{{%orders}}".
 *
 * @property string $id 订单 ID
 * @property string $user_id 用户 ID
 * @property string $name 称呼
 * @property string $phone 电话
 * @property int $area_id 地区
 * @property string $address 地址
 * @property string $memo 备注
 * @property int $created_at 创建时间
 * @property int $updated_at 修改时间
 * @property int $status 状态
 */
class Orders extends \yii\db\ActiveRecord
{
    /**
     * {@inheritdoc}
     */
    public static function tableName()
    {
        return '{{%orders}}';
    }

    /**
     * {@inheritdoc}
     */
    public function rules()
    {
        return [
            [['id', 'name', 'phone', 'address', 'memo'], 'required'],
            [['id', 'user_id', 'area_id', 'created_at', 'updated_at', 'status'], 'integer'],
            [['name'], 'string', 'max' => 20],
            [['phone'], 'string', 'max' => 40],
            [['address', 'memo'], 'string', 'max' => 255],
            [['id'], 'unique'],
        ];
    }

    /**
     * {@inheritdoc}
     */
    public function attributeLabels()
    {
        return [
            'id' => '订单 ID',
            'user_id' => '用户 ID',
            'name' => '称呼',
            'phone' => '电话',
            'area_id' => '地区',
            'address' => '地址',
            'memo' => '备注',
            'created_at' => '创建时间',
            'updated_at' => '修改时间',
            'status' => '状态',
        ];
    }
}
